<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>APP</title>
		<link rel="stylesheet" type="text/css" href="../css/aui.css" />
	</head>
	<style>
		.hidden {
			display: none;
		}
		.moban {
			margin-left: 5px;
			background: #0062CC;
			color: #fff;
		}
		.true {
			margin-left: 5px;
			background: #27AE60;
			border: 1px solid #27AE60;
			color: #fff;
		}
		.false {
			margin-left: 5px;
			background: #E13430;
			border: 1px solid #E13430;
			color: #fff;
		}
		button, .aui-btn {
			padding: 4px 6px;
			margin-bottom: 0;
			font-size: 16px;
		}
		.padding10 {
			padding: 10px 0px 5px 10px;
		}
		.paddingleft10 {
			padding-left: 10px;
		}
		.aui-form {
			border-radius: 5px;
			padding-top: 10px;
			padding-bottom: 10px;
		}
		.aui-input-row:first-child:after {
			border-top: 0px solid #c8c7cc;
		}
		.aui-input-row:last-child:after {
			border-bottom: 0px solid #c8c7cc;
		}
		.center {
			margin-left: auto;
			margin-right: auto;
			text-align: center;
		}
		.aui-btn {
			padding: 10px 40px;
			margin-top: 10px;
			font-size: 16px;
		}
		/*单选、多选*/
		.aui-radio {
			width: 20px;
			height: 20px;
			margin: 0px 20px;
		}
		.aui-radio-name {
			height: 20px;
			margin-top: 0;
			margin-bottom: 0px;
			margin-left: -10px;
		}
		.aui-radio:checked:before, .aui-radio.aui-checked:before {
			left: 1px;
			top: -2px;
			content: "\e75b";
		}
		.aui-radio:checked:after, .aui-radio.aui-checked:after {
			left: 1px;
			top: -2px;
			content: "\e75b";
		}
		.aui-input-row {
			padding-left: 20px;
		}
		.aui-input-row:first-child, .aui-input-row:last-child {
			padding-left: 0px;
		}
		.aui-user-view {
			margin: 0;
		}
	</style>
	<body>
		<div class="aui-content">
			<div id="history" class="aui-content">
				<p class="padding10">
					按用户签名类型
				</p>
				<ul class="aui-user-view">
					<li class="aui-user-view-cell paddingleft10">
						<input class="aui-radio aui-radio-info" type="radio" value='time' name="demo" checked onclick="setdata('')" tapmode>
						<div class="aui-radio-name">
							全部
						</div>
						<input class="aui-radio aui-radio-info" type="radio" value='time' name="demo" onclick="setdata('_T_')" tapmode>
						<div class="aui-radio-name">
							真实
						</div>
						<input class="aui-radio aui-radio-info" type="radio" value='time' name="demo" onclick="setdata('_F_')" tapmode>
						<div class="aui-radio-name">
							伪造
						</div>
					</li>
				</ul>
				<!--<p class="padding10">
				按用户签名时间
				</p>
				<ul class="aui-user-view">
				<li class="aui-user-view-cell paddingleft10">
				<label class="aui-input-addon aui-padded-10">开始</label>
				<input type="date" class="aui-input  aui-pull-right" placeholder="年/月/日" id="start">
				</li>
				<li class="aui-user-view-cell paddingleft10">
				<label class="aui-input-addon aui-padded-10">结束</label>
				<input type="date" class="aui-input aui-pull-right" placeholder="年/月/日" id="end">
				</li>
				</ul>			-->
				<p class="padding10">
					搜索历史
				</p>
				<ul class="aui-user-view" id="list"></ul>
			</div>
			<script id="template" type="text/x-dot-template">
				{{for(var i=0;i<it.length;i++){}}
				<li class="aui-user-view-cell aui-padded-10" onclick="SendName(this)" tapmode>
				{{=it[i]}}
				</li>
				{{}}}
				<li class="aui-user-view-cell center" onclick="ClearHistory()" tapmode>
				清除历史搜索记录
				</li>
			</script>
		</div>
	</body>
	<script type="text/javascript" src="../script/doT.min.js" ></script>
	<script type="text/javascript" src="../script/api.js" ></script>
	<script type="text/javascript" src="../script/zepto.js" ></script>
	<script type="text/javascript" src="../script/APICloud-rest-SHA1.js"></script>
	<script type="text/javascript" src="../script/signlist.js"></script>
	<script type="text/javascript">
		function ClearHistory() {
			var list_content = document.getElementById('list');
			list_content.innerHTML = "";			
			$api.rmStorage('historyname');
		}

		function SendName(el) {
			var val = $api.text(el);
			api.sendEvent({
				name : 'SearchName',
				extra : val
			});
		}		
		function setdata(val){
			var type=$api.setStorage('search_type',val);
		};

		function LoadHistory() {
			var listname = $api.getStorage('historyname') || [];
			var list_content = document.getElementById('list');
			if (listname.length > 0) {
				var template = document.getElementById('template');
				var pagefn = doT.template(template.text);
				list_content.innerHTML = pagefn(listname);
			} else {
				list_content.innerHTML = "";
			}
		}

		apiready = function() {	
		
			var type=$api.rmStorage('search_type');		
			LoadHistory();
			//缺省为用户签名
			//刷新文件事件
			//全选事件
			api.addEventListener({
				name : 'SignList_SelectAll'
			}, function(ret, err) {
				var id = "#list" + kind;
				console.log(kind + 'aaa');
				var listAll = $api.domAll(id + ' .aui-checkbox');
				for (var i = listAll.length - 1; i >= 0; i--) {
					if (listAll[i])
						listAll[i].checked = bSelect[kind];
				}
				bSelect[kind] = !bSelect[kind];
			});
			api.addEventListener({
				name : 'NewSearch'
			}, function(ret, err) {								
				LoadHistory();
			});
		}
	</script>
</html>